package com.xie.springCloud.service;

import com.xie.springCloud.pojo.Dept;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.stereotype.Component;
import org.springframework.stereotype.Service;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;

import java.util.List;

//提供者服务的主机名称
@Component
@FeignClient(name = "SPRINGCLOUD-PROVIDER-DEPT",fallbackFactory=DeptFallFallbackFactory.class)
public interface IDeptService {

    @GetMapping("/dept/get/{id}") //远程调用 提供者的接口
    Dept getById(@PathVariable("id") Long id);

    @GetMapping("/dept/list")
    List<Dept> getList();

    @PostMapping("/dept/add")
    boolean addDept(Dept dept);
}
